<template>
   <span>
       <el-link type="primary" @click="handlePreview" style="margin-right: 5px">预览</el-link>
       <el-link type="danger" @click="handleDel">删除</el-link>
    </span>
</template>

<script>
import {mapGetters} from 'vuex';

export default {
    data: function () {
        return {
            displayValue: ''
        };
    },
    beforeMount () {
    },
    computed: {
        ...mapGetters(['siteList']),
        siteId () {
            return this.$store.state.user.siteId;
        },
        siteInfo () {
            let info = this.siteList.find(res => res.id === Number(this.siteId));
            return info;
        }
    },
    methods: {
        handlePreview (id) {
            let url = 'https://' + this.siteInfo.domainName + '/products/' + `${this.params.data.fullName.replace(/%/g, '%25')}`;
            window.open(url, '_blank');
        },
        handleDel (id) {
            this.$store.commit('SET_DEL_ID', this.params.data.id);
        }
    }
};
</script>

<style scoped>

</style>
